package samples.zipcodes;

import java.util.List;

import br.cin.ufpe.in1118.middleware.distribution.services.naming.Naming;
import br.cin.ufpe.in1118.middleware.distribution.services.naming.NamingService;
import br.cin.ufpe.in1118.middleware.exceptions.RemoteException;

public class ZipCodesClient {

	public static void main(String[] args) {
		ZipCodes zipCode = null;
		Naming naming = NamingService.getNamingInstance("localhost", 9001);
		try {
			Object obj = naming.lookup(ZipCodes.SERVICE_NAME);
			if (obj instanceof ZipCodes) {
				zipCode = (ZipCodes) obj;
			}
			
			ZipCodeDetails details = zipCode.getDetailsFromZipCode("90015");
			System.out.println(details);
			
			Coordinates coords = zipCode.getCoordinatesFromZipCode("85750");
			System.out.println(coords);
			
			List<String> zipCodes = zipCode.zipCodesFromCityState("San Francisco", "CA");
			System.out.println("Zip Codes : " + zipCodes);
		} catch (RemoteException e) {
			e.printStackTrace();
		}
	}

}
